//
//  YZWorkeNoteAPI.m
//  VET
//
//  Created by 刘文靖 on 2018/7/10.
//  Copyright © 2018年 YZ. All rights reserved.
//

#import "YZWorkeNoteAPI.h"

@implementation YZWorkeNoteAPI
/** 工作笔记列表 */
+ (RACSignal*)requestWorkNoteList:(NSInteger)index{
    YZWorkeNoteAPI *api = [YZWorkeNoteAPI api];
    api.action = @"/api/note";
    api.showLoadingStatus = NO;
    [api addParam:@"index" value:@(index)];
    [api addParam:@"size" value:@(10)];
    return [api getRequest];
}
+ (RACSignal*)createNote:(NSDictionary *)dict{
    YZWorkeNoteAPI *api = [YZWorkeNoteAPI api];
    api.action = @"/api/note";
    api.showLoadingStatus = YES;
    [api addParams:dict];
    return [api postRequest];
}

/**更新笔记 */
+ (RACSignal*)updateNote:(NSDictionary *)dict{
    YZWorkeNoteAPI *api = [YZWorkeNoteAPI api];
    api.action = @"/api/note";
    api.showLoadingStatus = YES;
    [api addParams:dict];
    return [api putRequest];
}

/**删除笔记 */
+ (RACSignal*)deleteNote:(NSInteger )noteId{
    YZWorkeNoteAPI *api = [YZWorkeNoteAPI api];
    api.action =  [NSString stringWithFormat:@"/api/note/%ld",(long)noteId];;
    api.showLoadingStatus = YES;
    [api addParam:@"noteId" value:@(noteId)];
    return [api deleteRequest];
}

/**笔记列表(档案) */
+ (RACSignal*)requestArchivesWorkNoteList:(NSString *)type objId:(NSInteger)objId index:(NSInteger)index{
    YZWorkeNoteAPI *api = [YZWorkeNoteAPI api];
    api.action =  [NSString stringWithFormat:@"/api/note/%@/%ld",type,(long)objId];;
    api.showLoadingStatus = NO;
    [api addParam:@"index" value:@(index)];
    [api addParam:@"size" value:@(10)];
    return [api getRequest];
}
@end
